<template>
  <div id="left-choose">
    <div class="title">
      <span>题型选择</span>
    </div>    
    <el-tree :data="data"  @node-click="handleNodeClick" :default-expand-all="true"></el-tree>
  </div>
</template>

<script>
export default {
  name:'LeftChoose',
  data() {
      return {
        data: [{
          label: '选择题',
          children: [{
            label: '考试单选',
          },
          {
            label: '考试多选',
          },
          {
            label: '普通单选',
          },
          {
            label: '普通多选',
          }]
        }, {
          label: '填空题',
          children: [{
            label: '考试填空',
          },
          {
            label: '普通填空',
          }]
        }, {
          label: '考生信息',
          children: [{
            label: '学号',
          },
          {
            label: '姓名',
          }]
        }],
      };
    },
    emits: ['addQuestion'],
    methods: {
      handleNodeClick(data) {
        if(data.children == null) {
          this.$emit('addQuestion', data.label)
        }
      }
    }
}
</script>

<style scoped src='assets/css/editcss/leftChoose.css'>
  /* @import url('./css/leftChoose.css'); */
</style>
